// 获取文章列表
import request from '../utils/request'

/**
 *
 * @param {object} params
 * @returns promise
 */
export const getArticle = params => {
  return request({
    method: 'get',
    url: '/v1_1/articles',
    params
  })
}
// 文章详情
export const getArticleInfo = id => {
  return request({
    method: 'get',
    url: '/v1_0/articles/' + id
  })
}
/**
 * 文章添加收藏
 * @param {*} id
 * @returns promise
 */
export const addArticleClloeced = id => {
  return request({
    method: 'POST',
    url: '/v1_0/article/collections',
    data: {
      target: id
    }
  })
}
/**
 * 文章取消收藏
 * @param {*} id
 * @returns promise
 */
export const deleteArticleClloeced = id => {
  return request({
    method: 'DELETE',
    url: '/v1_0/article/collections/' + id
  })
}
/**
 * 点赞
 * @param {String} id
 * @returns promise
 */
export const addLikes = id => {
  return request({
    method: 'POST',
    url: '/v1_0/article/likings',
    data: {
      target: id
    }
  })
}
export const deleteLikes = id => {
  return request({
    method: 'POST',
    url: '/v1_0/article/dislikes',
    data: {
      target: id
    }
  })
}
